<style type="text/css">
    .wxcard-radio{display: block;}
</style>
<div class="control">



    <div class="editor_section">
        <!--<div class='form-group-title'>优惠使用限制</div>-->
        <div class="form-group">
            <label  class="col-lg control-label">优惠使用限制</label>
            <div class="col-sm-8 col-xs-12">
                {ife 'sale.coupon' $item}
                <label class="radio-inline wxcard-radio">
                    <input type="radio" name="limitdiscounttype" value="0" {if $item['limitdiscounttype'] == 0}checked="true"{/if}  /> 不添加优惠使用限制
                </label>
                <label class="radio-inline wxcard-radio">
                    <input type="radio" name="limitdiscounttype" value="1" {if $item['limitdiscounttype'] == 1}checked="true"{/if}" /> 不允许与促销优惠同时使用
                </label>
                <label class="radio-inline wxcard-radio">
                    <input type="radio" name="limitdiscounttype" value="2" {if $item['limitdiscounttype'] == 2}checked="true"{/if}  /> 不允许与会员折扣同时使用
                </label>
                <label class="radio-inline wxcard-radio">
                    <input type="radio" name="limitdiscounttype" value="3" {if $item['limitdiscounttype'] == 3}checked="true"{/if}  /> 不允许与促销优惠和会员折扣同时使用
                </label>


                {else} <div class='frm_controls'>
                {if $item['limitdiscounttype']==0}不添加优惠使用限制
                {else if $item['limitdiscounttype']==1}不允许与促销优惠同时使用
                {else if $item['limitdiscounttype']==2}不允许与会员折扣同时使用
                {else if $item['limitdiscounttype']==3}不允许与促销优惠和会员折扣同时使用
                {/if}
            </div>
                {/if}
                <p class='help-block'>卡券是否可以与特定优惠同时使用</p>
            </div>

        </div>
    </div>

    <div class="editor_section">
        <div class="form-group">
            <label  class="col-lg control-label">商品分类使用限制</label>
             <div class="col-sm-8 col-xs-12">
                 {ife 'sale.coupon' $item}
                 <label class="radio-inline wxcard-radio">
                     <input type="radio" name="limitgoodcatetype" value="0" {if $item['limitgoodcatetype'] == 0}checked="true"{/if}  onclick="$('.selectcats').hide();"/> 不添加商品分类限制
                 </label>
                 <label class="radio-inline wxcard-radio">
                     <input type="radio" name="limitgoodcatetype" value="1" {if $item['limitgoodcatetype'] == 1}checked="true"{/if} onclick="$('.selectcats').show();" /> 允许以下商品分类使用
                 </label>
                 <p class='help-block'>卡券是否只能用于特定商品或商品类型</p>

                 {else}
                 <div class='form-group'>
                     {if $item['limitgoodcatetype']==0}不添加商品分类限制
                     {else if $item['limitgoodcatetype']==1}允许以下商品分类使用
                     {/if}
                 </div>
                 {/if}
             </div>
        </div>
        <div class="form-group selectcats limitcats" {if $item['limitgoodcatetype']!=1&&$item['limitgoodcatetype']!=2}style="display:none"{/if}>
            {ife 'sale.coupon' $item}
             <label  class="col-lg control-label">选择商品分类</label>
                <div class="col-sm-8 col-xs-12">
                    <select id="cates"  name='cates[]' class="form-control select2"  >
                        {loop $goodcategorys $c}
                        <option value="{$c['id']}" {if is_array($cates) &&  in_array($c['id'],$cates)}selected{/if} >{$c['name']}</option>
                        {/loop}
                    </select>
                </div>
            {else}
                <div class='frm_controls'>
                    {loop $cates $c}
                    <a>{$goodcategorys[$c]['name']}</a>
                    {/loop}
                </div>
            {/if}
        </div>
    </div>


    <div class="editor_section">
        <div class="form-group">
            <label  class="col-lg control-label">商品使用限制</label>
            <div class="col-sm-8 col-xs-12">
                {ife 'sale.coupon' $item}
                <label class="radio-inline wxcard-radio">
                    <input type="radio" name="limitgoodtype" value="0" {if $item['limitgoodtype'] == 0}checked="true"{/if} onclick="$('.selectgoods').hide();" /> 不添加商品限制
                </label>
                <label class="radio-inline wxcard-radio">
                    <input type="radio" name="limitgoodtype" value="1" {if $item['limitgoodtype'] == 1}checked="true"{/if} onclick="$('.selectgoods').show();" /> 允许以下商品使用
                </label>

                {else}
                <div class='form-control-static'>
                    {if $item['limitgoodtype']==0}不添加商品限制
                    {else if $item['limitgoodtype']==1}允许以下商品使用
                    {/if}
                </div>
                {/if}
            </div>
        </div>
        <div class="form-group  selectgoods" {if $item['limitgoodtype']!=1&&$item['limitgoodtype']!=2}style="display:none"{/if}>
        {ife 'sale.coupon' $item}
        <label  class="col-lg control-label">选择商品</label>
                <div class="col-sm-8 col-xs-12">
                    <p class='help-block'>添加限制的商品必须已上架,并且不属于砍价商品.</p>
                    <?php echo tpl_selector('goodsid',array(
                            'preview'=>true,
                    'readonly'=>true,
                    'multi'=>1,
                    'url'=>webUrl('sale/coupon/querygoods'),
                    'items'=>$goods,
                    'buttontext'=>'选择商品',
                    'placeholder'=>'请选择商品')
                    )
                    ?>

                </div>
            </div>
        {else}
            {if !empty($goods)}
                {loop $goods $item}
                <a href="{php echo tomedia($item['thumb'])}" target='_blank'>
                    <img src="{php echo tomedia($item['thumb'])}" style='width:100px;border:1px solid #ccc;padding:1px' />
                </a>
                {/loop}
            {else}
                暂无商品
            {/if}
        {/if}
        </div>
    </div>

